package com.liyiqing.secondhandmall.productservice.service.impl;

import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liyiqing.commonservice.utils.PageUtils;
import com.liyiqing.commonservice.utils.Query;

import com.liyiqing.secondhandmall.productservice.dao.ProductSpuImagesDao;
import com.liyiqing.secondhandmall.productservice.entity.ProductSpuImagesEntity;
import com.liyiqing.secondhandmall.productservice.service.ProductSpuImagesService;

import javax.annotation.Resource;


@Service("productSpuImagesService")
public class ProductSpuImagesServiceImpl extends ServiceImpl<ProductSpuImagesDao, ProductSpuImagesEntity> implements ProductSpuImagesService {

    @Resource
    private ProductSpuImagesDao productSpuImagesDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<ProductSpuImagesEntity> page = this.page(
                new Query<ProductSpuImagesEntity>().getPage(params),
                new QueryWrapper<ProductSpuImagesEntity>()
        );

        return new PageUtils(page);
    }


    @Override
    public List<Long> selectImagesIdByProductId(Long spu_id) {
        return productSpuImagesDao.selectImagesIdByProductId(spu_id);
    }

    @Override
    public String selectImageUrlById(Long id) {
        return productSpuImagesDao.selectImageUrlById(id);
    }
}